const express = require('express')
const app = express()
const cors = require('cors')
app.use(cors())

app.use(express.json());

app.use(express.urlencoded({ extended: false }))
app.use(express.static('static'))

var { expressjwt } = require('express-jwt')
app.use( expressjwt({
  secret: '1234' ,
  algorithms: ['HS256'], 
}).unless( { path:['/user/login','/user/register'] } ) );

const routers = require('./router/Router')
app.use('/user', routers)
app.listen(8080, function () {
  console.log('服务器启动成功http://127.0.0.1:8080');
})